#!/usr/bin/env python
# -*- coding:utf-8 -*-

# file:do_jsonFile.py
# author:Jackiex
# datetime:2023/4/24 10:29
# software: PyCharm

"""
 1 对Json文件进行操作
"""

import json

# 读取JSON格式的文件
# with open("my_file.json","r") as f:
#    res = json.loads(f.read())
#    print(type(res))
#    print(res)


# 构造一个字典
my_dict = {"name": "Alice", "age": 25, "city": "New York"}

my_json_str = json.dumps(my_dict)

with open("my_file.json", "w") as f:
    f.write(my_json_str)
